<template>
	<div>
		parent
		<input type="text" v-model="num">

		<p>parent--{{info}}</p>
	
		<!-- 当自定义组件实现 -->
		<Child @sendMsg="getMsg" :num="parseNum"/>
	</div>
</template>
<script>

import Child from "./child"

	export default {
		name:"parent",
		data(){
			return{
				info:"",
				num:0
			}
		},
		methods: {
			getMsg: function (data) {
				this.info = data;
			}
		},
		components: {
			Child	
		},
		computed: {
			parseNum: function () {
				//将字符串转换为Number
				return this.num - 0;
			}
		}
	}
</script>
<style>
	
</style>